package define

func init()  {

	println("anonymity:----->")
	fn := func() {println("hello,fn")}
	fn()

	fns:=[]func(x int) int{
		func(x int) int {
			return x+1
		},
		func(x int) int {
			return x+2
		},
	}
	println("fns:",fns[0](100))

	d:= struct {
		fn func() string
	}{
		fn: func() string {
			return "hello,d.fn"
		},
	}
	println("d.fn:",d.fn())

	fc:=make(chan func() string,2)
	fc<- func() string {
		return "hello,fc"
	}
	println("fc:",(<-fc)())
}

func factorial(i int) int {
	if i<=1 {
		return i
	}
	return i*factorial(i-1)
}




